package org.example.myerp.controller;

import java.util.List;

import org.example.myerp.pojo.PageMyself;
import org.example.myerp.pojo.Protype;
import org.example.myerp.service.ProtypeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * ��Ʒ���Ϳ��Ʋ�
 * @author DELL
 *
 */
//@CrossOrigin(methods = { RequestMethod.POST, RequestMethod.GET }, allowCredentials = "true", allowedHeaders = "*")

@RestController
@RequestMapping("/design/protype")
public class ProtypeController {
	@Autowired
    ProtypeService protypeService;

	/**
	 * ��ѯȫ����Ʒ������Ϣ
	 * @return
	 */
	@RequestMapping("/getFindProtypeAll")
	@ResponseBody
	public List<Protype> getFindProtypeAll(){
		List<Protype> list = protypeService.getFindProtypeAll();
		return list;
	}

	/**
	 * �����������в�ѯȫ����Ʒ������Ϣ����ҳ��ѯ��
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	@RequestMapping("/getProtypes")
	@ResponseBody
	public PageMyself<Protype> getProtypes(Integer pageNum, Integer pageSize, String proType) {
		PageMyself<Protype> getProtypes = protypeService.findProtypeByPagerMessage((pageNum-1)*pageSize, pageSize,proType);
		return getProtypes;
	}

	/**
	 * ��Ӳ�Ʒ������Ϣ
	 * @param protype
	 * @return
	 */
	@RequestMapping("/getInsertProtypeByProTypeExplainAndProType")
	@ResponseBody
	public Integer getInsertProtypeByProTypeExplainAndProType(Protype protype) {
		Integer row = protypeService.getInsertProtypeByProTypeExplainAndProType(protype);
		return row;
	}

	/**
	 * ����ɾ����Ʒ������Ϣ
	 * @param pIds
	 * @return
	 */
	@RequestMapping("/getDeleteInBatchesProtypeByPIds")
	@ResponseBody
	public Integer getDeleteInBatchesProtypeByPIds(Integer[] pIds) {
		Integer row = protypeService.getDeleteInBatchesProtypeByPIds(pIds);
		return row;
	}
}
